/**
 * @copyright 2015 Indie Semiconductor.
 *
 * This file is proprietary to Indie Semiconductor.
 * All rights reserved. Reproduction or distribution, in whole
 * or in part, is forbidden except by express written permission
 * of Indie Semiconductor.
 *
 * @file gpio_sfrs_access.h
 */

#ifndef __GPIOA_SFRS_ACCESS_H__
#define __GPIOA_SFRS_ACCESS_H__

#include <stdbool.h>
#include <stdint.h>

/**
 * @brief Enable/disable pull up on GPIOA
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOA_EnablePullUp(uint8_t pos, bool bit);

/**
 * @brief Enable/disable pull down on GPIOA
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOA_EnablePullDown(uint8_t pos, bool bit);

/**
 * @brief Enable/disable output on GPIOA
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOA_EnableOutput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable Input on GPIOA
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOA_EnableInput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable interrupt on GPIOA
 *
 * @param pos The pin position.
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 */
void GPIOA_EnableInterrupt(uint8_t pos, bool r, bool f);

/**
 * @brief Read pin state on GPIOA
 *
 * @param pos The pin position.
 * @return The pin state.
 */
uint8_t GPIOA_Read(uint8_t pos);

/**
 * @brief Set pin state on GPIOA
 *
 * @param pos The pin position.
 * @param bit The pin state.
 */
void GPIOA_Set(uint8_t pos, uint8_t bit);

/**
 * @brief Enable/disable pull up bits on GPIOA
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOA_EnablePortPullUp(bool bit, uint8_t mask);

/**
 * @brief Enable/disable pull down enable bits on GPIOA
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOA_EnablePortPullDown(bool bit, uint8_t mask);

/**
 * @brief Enable/disable output enable bits on GPIOA
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOA_EnablePortOutput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable input enable bits on GPIOA
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOA_EnablePortInput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable interrupt enable bits on GPIOA
 *
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOA_EnablePortInterrupt(bool r, bool f, uint8_t mask);

/**
 * @brief Set port value on GPIOA
 *
 * @param val The value to be set to GPIO port.
 * @param mask The bit mask for the pins to be configured.
 * @return None.
 */
void GPIOA_PortSet(uint8_t val, uint8_t mask);

/**
 * @brief Read port value from GPIOA
 *
 * @param mask The bit mask for the pins to be read.
 * @return The masked port value from GPIOA.
 */
uint8_t GPIOA_PortRead(uint8_t mask);

/**
 * @brief Enable/disable pull up on GPIOB
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOB_EnablePullUp(uint8_t pos, bool bit);

/**
 * @brief Enable/disable pull down on GPIOB
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOB_EnablePullDown(uint8_t pos, bool bit);

/**
 * @brief Enable/disable output on GPIOB
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOB_EnableOutput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable Input on GPIOB
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOB_EnableInput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable interrupt on GPIOB
 *
 * @param pos The pin position.
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 */
void GPIOB_EnableInterrupt(uint8_t pos, bool r, bool f);

/**
 * @brief Read pin state on GPIOB
 *
 * @param pos The pin position.
 * @return The pin state.
 */
uint8_t GPIOB_Read(uint8_t pos);

/**
 * @brief Set pin state on GPIOB
 *
 * @param pos The pin position.
 * @param bit The pin state.
 */
void GPIOB_Set(uint8_t pos, uint8_t bit);

/**
 * @brief Enable/disable pull up bits on GPIOB
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOB_EnablePortPullUp(bool bit, uint8_t mask);

/**
 * @brief Enable/disable pull down enable bits on GPIOB
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOB_EnablePortPullDown(bool bit, uint8_t mask);

/**
 * @brief Enable/disable output enable bits on GPIOB
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOB_EnablePortOutput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable input enable bits on GPIOB
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOB_EnablePortInput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable interrupt enable bits on GPIOB
 *
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOB_EnablePortInterrupt(bool r, bool f, uint8_t mask);

/**
 * @brief Set port value on GPIOB
 *
 * @param val The value to be set to GPIO port.
 * @param mask The bit mask for the pins to be configured.
 * @return None.
 */
void GPIOB_PortSet(uint8_t val, uint8_t mask);

/**
 * @brief Read port value from GPIOB
 *
 * @param mask The bit mask for the pins to be read.
 * @return The masked port value from GPIOB.
 */
uint8_t GPIOB_PortRead(uint8_t mask);

/**
 * @brief Enable/disable pull up on GPIOC
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOC_EnablePullUp(uint8_t pos, bool bit);

/**
 * @brief Enable/disable pull down on GPIOC
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOC_EnablePullDown(uint8_t pos, bool bit);

/**
 * @brief Enable/disable output on GPIOC
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOC_EnableOutput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable Input on GPIOC
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOC_EnableInput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable interrupt on GPIOC
 *
 * @param pos The pin position.
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 */
void GPIOC_EnableInterrupt(uint8_t pos, bool r, bool f);

/**
 * @brief Select hardware mode mode on GPIO
 *
 * @param pos The pin position.
 * @param mode The hardware mode for the selected pin.
 */
void GPIOA_SelectMode(uint8_t pos, uint8_t mode);
void GPIOB_SelectMode(uint8_t pos, uint8_t mode);
void GPIOC_SelectMode(uint8_t pos, uint8_t mode);
void GPIOD_SelectMode(uint8_t pos, uint8_t mode);

/**
 * @brief Read pin state on GPIOC
 *
 * @param pos The pin position.
 * @return The pin state.
 */
uint8_t GPIOC_Read(uint8_t pos);

/**
 * @brief Set pin state on GPIOC
 *
 * @param pos The pin position.
 * @param bit The pin state.
 */
void GPIOC_Set(uint8_t pos, uint8_t bit);

/**
 * @brief Enable/disable pull up bits on GPIOC
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOC_EnablePortPullUp(bool bit, uint8_t mask);

/**
 * @brief Enable/disable pull down on GPIOC
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOC_EnablePortPullDown(bool bit, uint8_t mask);

/**
 * @brief Enable/disable output enable bits on GPIOC
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOC_EnablePortOutput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable input enable bits on GPIOC
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOC_EnablePortInput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable interrupt enable bits on GPIOC
 *
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOC_EnablePortInterrupt(bool r, bool f, uint8_t mask);

/**
 * @brief Set port value on GPIOC
 *
 * @param val The value to be set to GPIO port.
 * @param mask The bit mask for the pins to be configured.
 * @return None.
 */
void GPIOC_PortSet(uint8_t val, uint8_t mask);

/**
 * @brief Read port value from GPIOC
 *
 * @param mask The bit mask for the pins to be read.
 * @return The masked port value from GPIOC.
 */
uint8_t GPIOC_PortRead(uint8_t mask);

/**
 * @brief Enable/disable pull up on GPIOD
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOD_EnablePullUp(uint8_t pos, bool bit);

/**
 * @brief Enable/disable pull down on GPIOD
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOD_EnablePullDown(uint8_t pos, bool bit);

/**
 * @brief Enable/disable output on GPIOD
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOD_EnableOutput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable Input on GPIOD
 *
 * @param pos The pin position.
 * @param bit The enable bit, true for enable, false for disable.
 */
void GPIOD_EnableInput(uint8_t pos, bool bit);

/**
 * @brief Enable/disable interrupt on GPIOD
 *
 * @param pos The pin position.
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 */
void GPIOD_EnableInterrupt(uint8_t pos, bool r, bool f);

/**
 * @brief Read pin state on GPIOD
 *
 * @param pos The pin position.
 * @return The pin state.
 */
uint8_t GPIOD_Read(uint8_t pos);

/**
 * @brief Set pin state on GPIOD
 *
 * @param pos The pin position.
 * @param bit The pin state.
 */
void GPIOD_Set(uint8_t pos, uint8_t bit);

/**
 * @brief Enable/disable pull up bits on GPIOD
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOD_EnablePortPullUp(bool bit, uint8_t mask);

/**
 * @brief Enable/disable pull down on GPIOD
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOD_EnablePortPullDown(bool bit, uint8_t mask);

/**
 * @brief Enable/disable output enable bits on GPIOD
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOD_EnablePortOutput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable input enable bits on GPIOD
 *
 * @param bit The enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOD_EnablePortInput(bool bit, uint8_t mask);

/**
 * @brief Enable/disable interrupt enable bits on GPIOD
 *
 * @param r The rising edge enable bit, true for enable, false for disable.
 * @param f The falling edge enable bit, true for enable, false for disable.
 * @param mask The bit mask for the bits to be configured.
 * @return None.
 */
void GPIOD_EnablePortInterrupt(bool r, bool f, uint8_t mask);

/**
 * @brief Set port value on GPIOD
 *
 * @param val The value to be set to GPIO port.
 * @param mask The bit mask for the pins to be configured.
 * @return None.
 */
void GPIOD_PortSet(uint8_t val, uint8_t mask);

/**
 * @brief Read port value from GPIOD
 *
 * @param mask The bit mask for the pins to be read.
 * @return The masked port value from GPIOD.
 */
uint8_t GPIOD_PortRead(uint8_t mask);

#endif /* __GPIOA_SFRS_ACCESS_H__ */
